#!/usr/bin/env node

const http  =require('https');
const user = process.argv[2];

const addr = `https://gitee.com/api/v5/users/${user}/repos?access_token=5f3ff785d3cdfda2a575344d12bf1f16&type=all&sort=full_name&page=1&per_page=20`;

http.get(addr,(res)=>{
  //console.log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);
  //console.log(res.headers);
  //console.log();

  let data = '';
  res.on('data',(chunk)=>{
    data+=chunk;
  });
  res.on('end',()=>{
    data=JSON.parse(data);
    for (const repos of data){
      console.log(repos.path);
    }
  });

  //res.pipe(process.stdout);
});
